<html>
<head>
<link href="../../Objects/sofa_white.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="contenu">		
		<center><h3>Topology Tetra2TriangleTopologicalMapping</h3></center>
	        <center><img src="TopologyTetra2TriangleTopologicalMapping_01.png" width="300" name="TopologyTetra2TriangleTopologicalMapping" align="middle"></center>		  
	<br>	
	<div id="orangeText">Description</div>
	<br>
<div align="left">
	The aim of this tutorial is to show the interest of using a topological mapping between a 3D volume mesh and a 2D surface mesh. In this tutorial, a cylinder is represented, implying:
	<ul>
		<li>A mesh loader to read mesh file. (not necessary in regular mesh)</li>
		<li>A mechanicalObject with geometry point positions.</li>
		<li>A mass for gravity and fixed points.</li>
		<li>A FEM forcefield to create interactions between points</li>
		<li>An ODE scheme and a linear solver to solve the system at each time step.</li>
		<li>Dynamic topological components.</li>
		<li>A visual model which reproduces the current model geometry thanks to the identity mapping.</li>
	</ul>
        <br>
	<div id="orangeText">Key points</div>
	<br>
	Under the first node representing the tetrahedrization, a second node is used to represent the triangle topology.
	<br>
	This second representation won't reproduce all triangles of the tetrahedrization, but only triangles on the mesh borders. I.e triangles with only one adjacent tetrahedron. This process is similar to the <a href="TopologyTriangle2EdgeTopologicalMapping.scn">Triangle2EdgeTopologicalMapping</a>.
	<br>
	Edges of tetrahedra are represented in yellow in the simulation whereas the visual model is based on the triangles. Thus, display the scene in wire frame to see tetrahedra and triangles (in blue).
	<br>
	<br>
	To create this mapping, the component <b>Tetra2TriangleTopologicalMapping</b> is used. This component takes an input topology (Data Object1) which is the container of the "upper" topology (tetrahedron here) and has an output topology (Data Object2) which is the container of the above topology (triangle here).
	<br>
	<br>
	<div id="orangeText">Results</div>
	<br>
	As explained the visual model uses the output topology (triangles) to render the surface model.
	<br>
	You can try to directly use the triangles created in the <b>TetrahedronSetTopologyContainer</b> for the ogl model. The result will be a cylinder with triangles displayed inside the volume.
	<br>
	<br>
	Finally, try to remove the <b>TetrahedralCorotationalFEMForceField</b> or <b>TriangularBendingSprings</b> component. The result will be a bad behavior of the cylinder.
	<br>
	<center><img src="TopologyTetra2TriangleTopologicalMapping_02.png" width="300" name="TopologyTetra2TriangleTopologicalMapping" align="middle">
	</center>
	<br>
	<ul>
	  <li><div id="orangeText">Additional results</div></li>	
	<br>
	When deleting triangles, the topological mapping is updated. Thus, tetrahedra behind the selected triangle will be deleted as well. Then, the list of triangles on border will be updated and the surface rendering also.
	</ul>
</div>
</div>
</body>
</html>
